export const iceMessage = {
	success: () => {
		this.$refs.uToast.show({
			type: 'default',
			title: '默认主题',
			message: "锦瑟无端五十弦",
		})
	}
}
/**
 * @name 设置本地缓存(最后没加Sync为异步,同步的不能用了)
 * @key 键
 * @data 值
 */
export const iceSetStorage = (key, data) => {
	const strData = JSON.stringify(data)
	uni.setStorage({
		key: key,
		data: strData,
		success: function() {
			console.log(`${key}--success:${strData}`);
		}
	});
}

/**
 * @name 获取本地缓存(最后没加Sync为异步,同步的不能用了)
 * @key 键
 */
export const iceGetStorage = (key) => {
	return new Promise((resolve, reject) => {
		uni.getStorage({
			key: key,
			success: (res) => {
				resolve(JSON.parse(res.data));
			},
			fail: (error) => {
				reject(error)
			}
		});
		// wx.getStorage({
		//   key: 'key',
		//   success (res) {
		//     resolve(JSON.parse(res.data));
		//   }
		// })
	})
}
export const iceRemoveStorage = (key) => {
	return new Promise((resolve, reject) => {
		uni.removeStorage({
			key: key,
			success: function(res) {
				console.log(res);
			}
		});
	})
}

// export default {iceMessage,iceSetStorage,iceGetStorage}